package com.epfresh.supplier.entity;

import android.util.Log;

import com.epfresh.api.utils.DateUtil;

import java.util.List;

/**
 * Created by zhaozhenqiang on 2017/12/19.
 */

public class OrderOnGroupList {

    public String getJmtStatus() {
        return jmtStatus;
    }

    public void setJmtStatus(String jmtStatus) {
        this.jmtStatus = jmtStatus;
    }

    /**
     * orderStatusTitle : 交易取消
     * pack : 2公斤/袋
     * packageContainer : 袋
     * baseStoreName : 没有预设好的人
     * countLower : 1
     * deliverTime : 12月21日
     * buttonList : []
     * orderId : 98
     * requiredFreight : 28
     * grouponId : 94
     * orderStatus : 80
     * productId : 12050
     * packageSize : 2
     * productPriceUnit : 11
     * baseCityName : 邵阳市
     * orderNo : 184409
     * productCount : 28
     * reMainProductCount : 2222
     * requiredPayTotle : 336
     * productTitle : 莴苣
     * productImg : http://imgtest.epfresh.com/c0c6ec1c02792ff9da8dfe57a7ac4461.png-PRODUCTTHUMBNAIL
     * agencyCityName : 上海市
     * countUppe : 2222
     * packageUnit : 公斤
     * productPrice : 308
     * sumProductCount : 0
     * chargeUnit : 公斤
     */

    private String jmtStatus;
    private String watermark;
    private String orderStatusTitle;
    private String pack;
    private String packageContainer;
    private String baseStoreName;
    private String countLower;
    private String deliverTime;
    private String orderId;
    private String requiredFreight;
    private String grouponId;
    private String orderStatus;
    private String productId;
    private String packageSize;
    private String productPriceUnit;
    private String baseCityName;
    private String orderNo;
    private String productCount;
    private String reMainProductCount;
    private String requiredPayTotle;
    private String productTitle;
    private String productImg;
    private String agencyCityName;
    private String countUppe;
    private String packageUnit;
    private String productPrice;
    private String sumProductCount;
    private String chargeUnit;
    private List<ButtonListBean> buttonList;


    public String getWatermark() {
        return watermark;
    }

    public void setWatermark(String watermark) {
        this.watermark = watermark;
    }

    public String getOrderStatusTitle() {
        return orderStatusTitle;
    }

    public void setOrderStatusTitle(String orderStatusTitle) {
        this.orderStatusTitle = orderStatusTitle;
    }

    public String getPack() {
        return pack;
    }

    public void setPack(String pack) {
        this.pack = pack;
    }

    public String getPackageContainer() {
        return packageContainer;
    }

    public void setPackageContainer(String packageContainer) {
        this.packageContainer = packageContainer;
    }

    public String getBaseStoreName() {
        return baseStoreName;
    }

    public void setBaseStoreName(String baseStoreName) {
        this.baseStoreName = baseStoreName;
    }

    public String getCountLower() {
        return countLower;
    }

    public void setCountLower(String countLower) {
        this.countLower = countLower;
    }

    public String getDeliverTime() {
        return deliverTime;
    }

    public void setDeliverTime(String deliverTime) {
        this.deliverTime = deliverTime;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getRequiredFreight() {
        return requiredFreight;
    }

    public void setRequiredFreight(String requiredFreight) {
        this.requiredFreight = requiredFreight;
    }

    public String getGrouponId() {
        return grouponId;
    }

    public void setGrouponId(String grouponId) {
        this.grouponId = grouponId;
    }

    public String getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getPackageSize() {
        return packageSize;
    }

    public void setPackageSize(String packageSize) {
        this.packageSize = packageSize;
    }

    public String getProductPriceUnit() {
        return productPriceUnit;
    }

    public void setProductPriceUnit(String productPriceUnit) {
        this.productPriceUnit = productPriceUnit;
    }

    public String getBaseCityName() {
        return baseCityName;
    }

    public void setBaseCityName(String baseCityName) {
        this.baseCityName = baseCityName;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getProductCount() {
        return productCount;
    }

    public void setProductCount(String productCount) {
        this.productCount = productCount;
    }

    public String getReMainProductCount() {
        return reMainProductCount;
    }

    public void setReMainProductCount(String reMainProductCount) {
        this.reMainProductCount = reMainProductCount;
    }

    public String getRequiredPayTotle() {
        return requiredPayTotle;
    }

    public void setRequiredPayTotle(String requiredPayTotle) {
        this.requiredPayTotle = requiredPayTotle;
    }

    public String getProductTitle() {
        return productTitle;
    }

    public void setProductTitle(String productTitle) {
        this.productTitle = productTitle;
    }

    public String getProductImg() {
        return productImg;
    }

    public void setProductImg(String productImg) {
        this.productImg = productImg;
    }

    public String getAgencyCityName() {
        return agencyCityName;
    }

    public void setAgencyCityName(String agencyCityName) {
        this.agencyCityName = agencyCityName;
    }

    public String getCountUppe() {
        return countUppe;
    }

    public void setCountUppe(String countUppe) {
        this.countUppe = countUppe;
    }

    public String getPackageUnit() {
        return packageUnit;
    }

    public void setPackageUnit(String packageUnit) {
        this.packageUnit = packageUnit;
    }

    public String getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(String productPrice) {
        this.productPrice = productPrice;
    }

    public String getSumProductCount() {
        return sumProductCount;
    }

    public void setSumProductCount(String sumProductCount) {
        this.sumProductCount = sumProductCount;
    }

    public String getChargeUnit() {
        return chargeUnit;
    }

    public void setChargeUnit(String chargeUnit) {
        this.chargeUnit = chargeUnit;
    }

    public List<ButtonListBean> getButtonList() {
        return buttonList;
    }

    public void setButtonList(List<ButtonListBean> buttonList) {
        this.buttonList = buttonList;
    }
    public class ButtonListBean {

        /**
         * title : 支付定金45.6元
         * remainTime : 0
         * code : supplyPayFirst
         * endTime : 2017-12-21 19:09:06.000
         */

        private String title;
        private int remainTime;
        private String code;
        private String endTime;
        private String startTime;
        private long localeTime;

        public ButtonListBean() {
            localeTime = getNowTime();
        }
        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public int getRemainTime() {
            return remainTime;
        }

        public void setRemainTime(int remainTime) {
            this.remainTime = remainTime;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getEndTime() {
            return endTime;
        }

        public void setEndTime(String endTime) {
            this.endTime = endTime;
        }


        private long nowRemindTime;

        public String getStartTime() {
            return startTime;
        }

        public void setStartTime(String startTime) {
            this.startTime = startTime;
        }

        public long getNowRemindTime() {
            return nowRemindTime;
        }

        public void setNowRemindTime(long nowRemindTime) {
            this.nowRemindTime = nowRemindTime;
        }

        public String getReminderTime(){
            if (startTime != null && endTime != null){
                long tEnd = DateUtil.formatTimeLong(endTime);
                long tServer = DateUtil.formatTimeLong(startTime);
                if(localeTime == 0){
                    localeTime = getNowTime();
                }

                long tLocale;

                if (Math.abs(tServer - localeTime) > 60){
                    tLocale = (tServer - localeTime + getNowTime());
                }else {
                    tLocale = getNowTime();
                }
                if (tLocale <= tEnd){//活动进行中
                    nowRemindTime = (tEnd - tLocale)/1000;
                    String timeFlag;
                    if (nowRemindTime > 60) {
                        long hour = nowRemindTime/3600;
                        long minus = nowRemindTime%3600 / 60;
                        long sec = nowRemindTime % 60;
                        if (hour < 10) {
                            timeFlag = "0" + hour;


                            if (minus < 10) {
                                timeFlag += ":0" + minus;
                            } else {
                                timeFlag += ":" + minus;
                            }
                            if (sec < 10) {
                                timeFlag += ":0" + sec;
                            } else {
                                timeFlag += ":" + sec;
                            }

                        } else {
                            timeFlag = "" + hour;

                            if (minus < 10) {
                                timeFlag += ":0" + minus;
                            } else {
                                timeFlag += ":" + minus;
                            }
                            if (sec < 10) {
                                timeFlag += ":0" + sec;
                            } else {
                                timeFlag += ":" + sec;
                            }

                        }
                        return timeFlag;


                    } else if (nowRemindTime > 0) {
                        if (nowRemindTime < 10) {
                            timeFlag = "00:00:0" + nowRemindTime;
                        } else {
                            timeFlag = "00:00:" + nowRemindTime;
                        }
                        return timeFlag;
                    }



                }else {//活动结束了
                    return "";
                }
            }

            return "";
        }

        public long getNowTime() {
            return System.currentTimeMillis();
        }


    }
}
